<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Date</title>
    <script type="text/javascript">

        function dateFormat(date){
            var month = Number(date.getMonth() + 1) < 10 ? "0"+Number(date.getMonth() + 1) : Number(date.getMonth() + 1);
            var day = date.getDate() < 10 ? "0"+date.getDate() : date.getDate();
            var hour = date.getHours() < 10 ? "0"+date.getHours() : date.getHours();
            var minutes = date.getMinutes() < 10 ? "0"+date.getMinutes() : date.getMinutes();
            var seconds = date.getSeconds() < 10 ? "0"+date.getSeconds() : date.getSeconds();
            var s = date.getFullYear() +"-"+ month +"-"+ day + " " + hour +":"+ minutes +":"+ seconds;
            return s;
        }
        var format = dateFormat(new Date("2022/1/1 1:3:1"));
        alert(format);
    </script>
</head>
<body>

</body>
</html>